﻿Public Class frmMain

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        HienThi()
        frmDangNhap.ShowDialog()
    End Sub


 

    Public Sub HienThi()
        lbxinchao.Text = "Bạn đăng nhập mới sử dụng được phần mềm!"
        NghiepVu.Enabled = False
        NhapXuatDuLieu.Enabled = False
        QuanLy.Enabled = False
        TimKiem.Enabled = False
        TaiKhoan.Enabled = False
        SaoLuuCSDL.Enabled = False

        btnTiepNhanChuNha.Enabled = False
        btnTiepNhanNha.Enabled = False
        btnTiepNhanKhachThue.Enabled = False

        btnXuatDuLieu.Enabled = False
        btnNhapDuLieu.Enabled = False


        btnDanhSachNha.Enabled = False
        btnDanhSachChuNha.Enabled = False
        btnDanhSachKhachThue.Enabled = False

        btnTiemKiemNha.Enabled = False
        btnTimKiemTheoTen.Enabled = False

        btnDanhSachTaiKhoan.Enabled = False
        btnPhanQuyen.Enabled = False

        btndang_nhap.Enabled = True


        btnDangXuat.Enabled = False




    End Sub
    Public Sub PhanQuyenNghiepVu()

        NghiepVu.Enabled = False
        NhapXuatDuLieu.Enabled = True
        QuanLy.Enabled = False
        TimKiem.Enabled = False
        TaiKhoan.Enabled = False
        SaoLuuCSDL.Enabled = True


        btnTiepNhanChuNha.Enabled = False
        btnTiepNhanNha.Enabled = False
        btnTiepNhanKhachThue.Enabled = False

        btnXuatDuLieu.Enabled = True
        btnNhapDuLieu.Enabled = True


        btnDanhSachNha.Enabled = False
        btnDanhSachChuNha.Enabled = False
        btnDanhSachKhachThue.Enabled = False

        btnTiemKiemNha.Enabled = False
        btnTimKiemTheoTen.Enabled = False

        btnDanhSachTaiKhoan.Enabled = False
        btnPhanQuyen.Enabled = False

        btndang_nhap.Enabled = False

        btnDangXuat.Enabled = True

    End Sub
    Public Sub PhanQuyenQuanLy()
        NghiepVu.Enabled = True
        NhapXuatDuLieu.Enabled = False
        QuanLy.Enabled = True
        TimKiem.Enabled = True
        TaiKhoan.Enabled = True
        SaoLuuCSDL.Enabled = False

        btnTiepNhanChuNha.Enabled = True
        btnTiepNhanNha.Enabled = True
        btnTiepNhanKhachThue.Enabled = True

        btnXuatDuLieu.Enabled = False
        btnNhapDuLieu.Enabled = False


        btnDanhSachNha.Enabled = True
        btnDanhSachChuNha.Enabled = True
        btnDanhSachKhachThue.Enabled = True

        btnTiemKiemNha.Enabled = True
        btnTimKiemTheoTen.Enabled = True

        btnDanhSachTaiKhoan.Enabled = True
        btnPhanQuyen.Enabled = True

        btndang_nhap.Enabled = False
        btnDangXuat.Enabled = True

    End Sub


    Private Sub btnDangXuat_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDangXuat.Click
        HienThi()
        lbxinchao.Text = "Bạn đăng nhập mới sử dụng được phần mềm!"

        frmDangNhap.ShowDialog()

    End Sub



    Private Sub btnTiepNhanChuNha_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTiepNhanChuNha.Click
        frmTiepNhanKHChoThue.Show()
    End Sub

    Private Sub btnTiepNhanNha_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTiepNhanNha.Click
        frmTiepNhanNhaThue.Show()
    End Sub

    Private Sub btnTiepNhanKhachThue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTiepNhanKhachThue.Click
        frmTiepNhanKHThueNha.Show()
    End Sub

    Private Sub btnDanhSachNha_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDanhSachNha.Click
        frmDanhSachNha.Show()
    End Sub

    Private Sub btnDanhSachChuNha_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDanhSachChuNha.Click
        frmQLKHChoThue.Show()
    End Sub

    Private Sub btnDanhSachKhachThue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDanhSachKhachThue.Click
        frmQLKHThueNha.Show()
    End Sub

    Private Sub btnTiemKiemNha_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTiemKiemNha.Click
        frmTimKiemNha.Show()
    End Sub

    Private Sub btnSaoLuu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaoLuu.Click
        frmBackup.Show()
    End Sub

    Private Sub btnPhucHoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPhucHoi.Click
        frmRestore.Show()
    End Sub

    Private Sub btnDanhSachTaiKhoan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDanhSachTaiKhoan.Click
        frmQLTaiKhoan.Show()
    End Sub

    Private Sub btnXuatDuLieu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXuatDuLieu.Click
        frmXuatDuLieu.Show()
    End Sub

    Private Sub btnNhapDuLieu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNhapDuLieu.Click
        frmNhapDuLieu.Show()
    End Sub

  
    Private Sub btndang_nhap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndang_nhap.Click
        frmDangNhap.Show()
    End Sub


    Private Sub btnTimKiemTheoTen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTimKiemTheoTen.Click
        btnTimKiemChuNha.Show()
    End Sub



    Private Sub MetroTileItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MetroTileItem2.Click
        frmBaoCaoThang.Show()
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Process.Start("./TroGiup.chm")
    End Sub
End Class